<template>
    <div class="userinfo-idcard">
        <div class="item">
            <div class="bj">
                <div class="top">
                    <div class="left"><img v-if="src!=''" :src="src" alt=""><img v-else src="../../assets/image/default.png" alt=""></div>
                    <div class="right">
                        <p>{{name}}</p>
                        <p>{{idcard}}</p>
                    </div>
                </div>
                <div class="bot"></div>
            </div>
        </div>
        <router-link to="/userinfolist" class="item-lr">
            <div class="left">个人信息</div>
            <div class="right"><i class="iconfont">&#xe871;</i></div>
        </router-link>
        <div @click="show()" class="item-lr">
            <div class="left">证件照片</div>
            <div class="right"><i class="iconfont">&#xe871;</i></div>
        </div>
        <div :class="['s-modal',{'opacity': isshow}]">
            <div class="close"><img @click="close()" src="../../assets/image/cha.png" alt=""></div>
            <div class="img">
                <img :src="card_img+'?x-oss-process=image/resize,m_fill,h_198,w_198'" alt="">
            </div>
        </div>
    </div>
</template>

<script>
import Header from '../common/header';
import axios from 'axios';
import { MessageBox, Popup } from 'mint-ui';
export default {
    data () {
        return {
            idcard: '',
            name: '',
            src: '',
            card_img: '',
            isshow: true
        }
    },
    components: {
        'h-header': Header
    },
    created () {
        const vm = this;
        axios.post('/Weixin/Member/memberDetail',{}).then(res=>{
            const data = res.data;
            console.log(data,'身份认证');
            if(data.code==1){
                vm.name= data.data.name;
                vm.card_img = data.data.card_img;
                if( data.data.idNumber.length==15){
                    vm.idcard = data.data.idNumber.substr(0,1)+'*************'+ data.data.idNumber.substr(14);
                }else {
                    vm.idcard = data.data.idNumber.substr(0,1)+'****************'+ data.data.idNumber.substr(17);
                }
              
                vm.src = data.data.headimgurl;
            }else {
                MessageBox.alert(data.msg)
            }
        }).catch(()=>{
            MessageBox.alert('网络错误');
        })
    },
    mounted() {
        const vm = this;
        let url = window.location.href;
        vm.wxShare(url);
    },
    methods: {
        show(){
            this.isshow = false;
        },
        close(){
            this.isshow = true;
        }
    }
}
</script>

<style>

</style>
